package com.llh.uua.validation

import com.llh.uua.model.dto.UserDto
import com.llh.uua.validation.annotation.PasswordMatches
import javax.validation.ConstraintValidator
import javax.validation.ConstraintValidatorContext

/**
 *
 *
 * Created At 2021/3/16 21:17
 * @author llh
 */
class PasswordMatchesValidator : ConstraintValidator<PasswordMatches, UserDto> {

    override fun isValid(user: UserDto, context: ConstraintValidatorContext): Boolean {
        return user.password == user.matchingPassword
    }
}